package com.schoolvisitors.controller.admin;

import com.schoolvisitors.CheckPermission;
import com.schoolvisitors.enums.PermissionEnum;
import com.schoolvisitors.response.ResultBody;
import com.schoolvisitors.service.ImgService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/api/v1/admin")
public class AdminUploadController {

    private final ImgService imgService;

    public AdminUploadController(ImgService imgService) {
        this.imgService = imgService;
    }

    @CheckPermission(PermissionEnum.SYSTEM_ADMIN)
    @PostMapping("/uploadImg")
    public ResultBody uploadImage(@RequestParam("file") MultipartFile file) {
        return imgService.uploadByImg(file);
    }

    @CheckPermission(PermissionEnum.SYSTEM_ADMIN)
    @PostMapping("/uploadVideo")
    public ResultBody uploadVideo(@RequestParam("file") MultipartFile file) {
        return imgService.uploadByVideo(file);
    }


}
